package cn.rentaotao.spring.mapper;

import cn.rentaotao.spring.data.Spittle;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author rtt
 * @date 2022/5/11 17:59
 */
@Repository
public class DefaultSpittleMapper implements SpittleMapper {

    @Override
    public List<Spittle> findSpittles(int start, int count) {

        List<Spittle> spittles = new ArrayList<>(count);
        for (int i = 0; i < count; i++) {
            spittles.add(new Spittle(start + i, "Spittle" + (start + i), new Date()));
        }

        return spittles;
    }
}
